<?php

namespace app\common\validate\product\order;

use think\Validate;

class Product extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'orderid' => ['require'],
        'busid' => ['require'],
        'proid' => ['require'],
        'pronum' => ['require', '>:0'],
        'price' => ['require', '>:0'],
        'total' => ['require', '>:0']
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */
    protected $message = [
        'orderid.require'    => '订单ID未知',
        'proid.require'    => '商品ID未知',
        'pronum.require'    => '请填写商品数量',
        'price.require'    => '请填写商品的单价',
        'total.require'    => '请填写商品的总价',
        'pronum.>:'    => '商品数量大于0',
        'price.>:'    => '商品的单价大于0',
        'total.>:'    => '商品的总价大于0'
    ];

    /**
     * 验证场景定义
     * 格式：'场景名称'	=>	['字段1','字段2'...]
     *
     * @var array
     */
    protected $scene = [];
}
